package cn.elwy.rcp.ui.explorer.composite;

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;

public class ModuleComposite extends Composite {
  private Table table;

  /**
   * Create the composite.
   * 
   * @param parent
   * @param style
   */
  public ModuleComposite(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout(1, false));

    Group group_1 = new Group(this, SWT.NONE);
    group_1.setLayout(new GridLayout(1, false));
    group_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    group_1.setText("构建组件");

    // TableTreePane group = new TableTreePane(group_1, SWT.NONE, PathConst.TABLE_PANE_BUILD_MODULE);
    // group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    // group.setInput(new Tree1DataModelInput());

    CheckboxTableViewer checkboxTableViewer = CheckboxTableViewer.newCheckList(group_1, SWT.CHECK | SWT.MULTI
        | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    table = checkboxTableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    TableViewerColumn tableViewerColumn = new TableViewerColumn(checkboxTableViewer, SWT.NONE);
    TableColumn tblclmnIp = tableViewerColumn.getColumn();
    tblclmnIp.setToolTipText("更目录相对于源码目录/SourceCode/");
    tblclmnIp.setWidth(205);
    tblclmnIp.setText("模块名称");

    TableViewerColumn tableViewerColumn_1 = new TableViewerColumn(checkboxTableViewer, SWT.NONE);
    TableColumn tableColumn = tableViewerColumn_1.getColumn();
    tableColumn.setToolTipText("相对于容器根目录/WEB-INF/sofa-container/");
    tableColumn.setWidth(136);
    tableColumn.setText("输出目录");

    TableItem tableItem_1 = new TableItem(table, 0);
    tableItem_1.setChecked(true);
    tableItem_1.setText(new String[] { "/01-Container/ext/com.yss.sofa.installer", "/kernel/ext" });

    TableItem tableItem_2 = new TableItem(table, 0);
    tableItem_2.setText(new String[] { "/01-Container/ext/com.yss.sofa.container.webconsole", "/kernel/ext" });

  }

  @Override
  protected void checkSubclass() {
    // Disable the check that prevents subclassing of SWT components
  }

}
